Given that there are N books and M students. Also given are the number of pages in each book in ascending order. The task is to assign books in such a way that the maximum number of pages assigned to a student is minimum, with the condition that every student is assigned to read some consecutive books. Print that minimum number of pages....
Given an array arr[] consisting of N integers representing the number of coins in each pile, and an integer H, the task is to find the minimum number of coins that must be collected from a single pile per hour such that all the piles are emptied in less than H hours....
Amazon called for an interview for Hyderabad campus....
Quick sort is an internal algorithm which is based on divide and conquer strategy. In this:...
Greedy algorithm, divide and conquer algorithm, and dynamic programming algorithm are three common algorithmic paradigms used to solve problems. Here’s a comparison among these algorithms:...
Given N rods of different lengths. The task is to cut all the rods with some maximum integer height ‘h’ such that the sum of cut-off lengths of the rod is maximized and must be greater than M. Print -1 if no such cut is possible. Note: A rod cannot be cut also. Examples:...
Given an unsorted array arr[] of length N, the task is to find the median of this array. Median of a sorted array of size N is defined as the middle element when n is odd and average of middle two elements when n is even....
Binary Search is a technique used to search element in a sorted list. In this article, we will looking at library functions to do Binary Search.Finding first occurrence of an element....
Given a list of n-1 integers and these integers are in the range of 1 to n. There are no duplicates in list. One of the integers is missing in the list. Write an efficient code to find the missing integer. Examples:...
Given two integers m & n, find the number of possible sequences of length n such that each of the next element is greater than or equal to twice of the previous element but less than or equal to m....
In computational geometry, a convex hull is the smallest convex polygon that contains a given set of points. It is a fundamental concept with applications in various fields such as computer graphics, robotics, and image processing....
Given a sorted matrix mat[n][m] and an element ‘x’. Find the position of x in the matrix if it is present, else print -1. Matrix is sorted in a way such that all elements in a row are sorted in increasing order and for row ‘i’, where 1 <= i <= n-1, the first element of row ‘i’ is greater than or equal to the last element of row ‘i-1’. The approach should have O(log n + log m) time complexity....